package com.njtoyo.taxi.admin.rest.wrapper.local_service.commodity;

import com.njtoyo.taxi.admin.mapper.master.enums.local_service.LifeMerchantCommodityState;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Digits;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;

@Data
public class CommodityAddWrapper {

    @ApiModelProperty(value = "商家ID")
    @NotNull(message = "商家ID不能为空")
    private Long merchantId;

    @ApiModelProperty(value = "商品类型ID")
    @NotNull(message = "商品类型ID不能为空")
    private Long commodityCategoryId;

    @ApiModelProperty(value = "商品名称")
    @NotNull(message = "商品名称不能为空")
    private String name;

    @ApiModelProperty(value = "商品标题")
    private String title;

    @ApiModelProperty(value = "分润比例")
    @Digits(integer = 3, fraction = 2, message = "分润比例不能超过100")
    private BigDecimal proportion;

    @ApiModelProperty(value = "商品价格")
    @NotNull(message = "商品价格不能为空")
    private Integer unitPrice;

    @ApiModelProperty(value = "原价")
    private Integer originalCost;

    @ApiModelProperty(value = "商品分成价")
    private Integer shareProfitPrice;

    @ApiModelProperty(value = "商品积分")
    private Integer unitPoint;

    @ApiModelProperty(value = "库存")
    private Integer store;

    @ApiModelProperty(value = "商品状态 0:waiting_for_review[待审核],1:review_failed[审核未通过],2:review_approved[审核已通过(未上架)],3:on_shelf[已上架],4:freeze_up[冻结]")
    private LifeMerchantCommodityState state;

    @ApiModelProperty(value = "开始时间")
    private String startedAt;

    @ApiModelProperty(value = "结束时间")
    private String endedAt;

    @ApiModelProperty(value = "商品图片URL")
    private String iconImageUrl;

    @ApiModelProperty(value = "商品详情")
    private String details;

    @ApiModelProperty(value = "排序号;越大越前")
    private Integer sortBy;

    //@ApiModelProperty(value = "需要去自提点提货 0:false,1:true")
    //private Boolean toPickUpLocation;

    @ApiModelProperty(value = "核销数量")
    private Integer verificationCount;

    @ApiModelProperty(value = "特殊商品规则，例如优惠券：[{'templateId': 1, 'quantity': 1}]")
    private List<template> template;

    @ApiModelProperty(value = "兑换后截止日期天数")
    private Integer deadlineDay;

    @ApiModelProperty(value = "是否为赠送商品")
    private Boolean isPresented;

    @Data
    public static class template {

        @ApiModelProperty(value = "优惠券模板id")
        private Long templateId;

        @ApiModelProperty(value = "数量")
        private Long quantity;

    }
}
